package cn.easy.rpc.services;

import cn.easy.rpc.annotations.RpcInstance;
import cn.easy.rpc.common.CartService;
import cn.easy.rpc.dto.Cart;
import cn.easy.rpc.dto.Commodity;
import com.google.common.collect.Lists;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author zwb
 * @create 2020-09-07 19:51
 **/
@RpcInstance(schema = "cart")
public class CartServiceImpl implements CartService {
    @Override
    public boolean insertCart(Cart cart) {
        System.out.println("假装存放到了db->"+cart.toString());
        return true;
    }

    @Override
    public List<Commodity> commodityList() {
        List<Commodity> commodities = Lists.newArrayList();
        commodities.add(new Commodity(new BigDecimal("20188.98"),"MacBook Pro"));
        commodities.add(new Commodity(new BigDecimal("158.98"),"MacBook Pro 外壳"));
        commodities.add(new Commodity(new BigDecimal("4899.98"),"华为MateBook"));
        commodities.add(new Commodity(new BigDecimal("3999.98"),"荣耀MagicBook"));
        commodities.add(new Commodity(new BigDecimal("11243.98"),"MacBook Air"));
        return commodities;
    }
}
